<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue.min.js"></script>
</head>
<body>
<div id="app">
    <input type="button" value="开始" @click="lang">
    <input type="button" value="结束" @click="stop">
    <h4>{{msg}}</h4>
</div>
</body>
<script>
    const vm = new Vue({
        el: '#app',
        data: {
            msg: '猥琐发育,别浪～～！',
            intervalId: null
        },
        methods: {
            lang() {
                if (this.intervalId == null) {
                    this.intervalId = setInterval(() => {
                        console.log(this.msg);
                        let start = this.msg.substring(0, 1);
                        let end = this.msg.substring(1);
                        this.msg = end + start
                    }, 200)
                }
            },
            stop() {
                clearInterval(this.intervalId);
                this.intervalId = null
            }
        }
    })
</script>
</html>